<template>
  <div class="app-container">
   <el-form
    :model="queryParams"
      ref="queryForm"
      size="small"
      v-show="showSearch"
      label-width="0px">
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="" prop="noticeAssetNumber">
            <el-input
              v-model="queryParams.noticeAssetNumber"
              placeholder="固定资产标签编号"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="" prop="sysCardNumber">
            <el-input
              v-model="queryParams.sysCardNumber"
              placeholder="固定资产管理系统卡片号"
    clearable
    size="small"
    @keyup.enter.native="handleQuery"
  />
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="deviceType">
        <el-select v-model="queryParams.deviceType" size="small" placeholder="设备类型" style="width:100%"
                    clearable
        >
          <el-option
            v-for="dict in dict.type.fa_device_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="deviceName">
        <el-input
          v-model="queryParams.deviceName"
          placeholder="设备名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="claimingDate">
        <el-date-picker
          size="small"
          v-model="queryParams.claimingDateDateRange"
          style="width: 100%"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="领用开始日期"
          end-placeholder="领用结束日期"
        ></el-date-picker>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="originalOwner">
        <el-input
          v-model="queryParams.originalOwner"
          placeholder="原领用人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    </el-col>
  <!-- </el-row> -->
  <!-- <el-row :gutter="20"> -->
    <el-col :span="6">
      <el-form-item label="" prop="discRepletion">
        <el-input
          v-model="queryParams.discRepletion"
          placeholder="盘实"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="tag">
        <el-input
          v-model="queryParams.tag"
          placeholder="标签"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="vacetsu">
        <el-select v-model="queryParams.vacetsu" size="small" placeholder="设备状态" style="width:100%" clearable>
          <el-option
            v-for="dict in dict.type.fa_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="retirementLife">
        <el-input
          v-model="queryParams.retirementLife"
          placeholder="报废年限"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="disposalScheme">
        <el-select v-model="queryParams.disposalScheme" size="small" placeholder="处置方案" style="width:100%"
                    clearable
        >
          <el-option
            v-for="dict in dict.type.fa_disposal_scheme"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="department">
        <el-input
          v-model="queryParams.department"
          placeholder="所属部门"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    </el-col>
    <el-col :span="6">

      <el-form-item label="" prop="disposalPriority">
        <el-select v-model="queryParams.disposalPriority" size="small" placeholder="处置优先级" style="width:100%"
                    clearable
        >
          <el-option
            v-for="dict in dict.type.fa_disposal_priority"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="retirementStatus">
        <el-select v-model="queryParams.retirementStatus" size="small" placeholder="报废状态" style="width:100%"
                    clearable
        >
          <el-option
            v-for="dict in dict.type.fa_retirement_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="6">
      <el-form-item label="" prop="retirementDate">
        <el-date-picker
          size="small"
          v-model="queryParams.retirementDateDateRange"
          style="width: 100%"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="报废开始日期"
          end-placeholder="报废结束日期"
        ></el-date-picker>
      </el-form-item>
    </el-col>
  </el-row>
  <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
   </el-form>
   <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleExport"
          :disabled='multiple'
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" ref="multipleTable" :data="excutionList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" fixed="left" align="center"/>
      <el-table-column label="固定资产标签编号" align="center" fixed="left" prop="assetTagNumber" width="180"></el-table-column>
      <el-table-column label="云中心资产标签" align="center" fixed="left" prop="cloudCenterAssetTag" width="150"
      ></el-table-column>
      <el-table-column label="固定资产增加通知单固定资产编号" align="center" prop="noticeAssetNumber" width="220"></el-table-column>
      <el-table-column label="固定资产增加通知单编号" align="center" prop="noticeNumber" width="180"></el-table-column>
      <el-table-column label="固定资产管理系统卡片号" align="center" prop="sysCardNumber" width="180"></el-table-column>
      <el-table-column label="固定资产管理系统卡片唯一编号" align="center" prop="sysCardUniqueNumber" width="220"></el-table-column>
      <el-table-column label="固定资产管理系统目录代码" align="center" prop="sysDirectoryCode" width="180"></el-table-column>
      <el-table-column label="资产分类" align="center" prop="assetClassify" width="150"></el-table-column>
      <el-table-column label="分类" align="center" prop="classify" width="100"></el-table-column>
      <el-table-column label="设备名称" align="center" prop="deviceName" width="100"></el-table-column>
      <el-table-column label="品牌" align="center" prop="brand" width="100"></el-table-column>
      <el-table-column label="设备型号" align="center" prop="deviceType" width="100"></el-table-column>
      <el-table-column label="设备规格" align="center" prop="deviceSpec" width="100"></el-table-column>
      <el-table-column label="序列号" align="center" prop="serialNumber" width="150"></el-table-column>
      <el-table-column label="数量" align="center" prop="quantity" width="100"></el-table-column>
      <el-table-column label="单位" align="center" prop="unit" width="100"></el-table-column>
      <el-table-column label="金额" align="center" prop="amount" width="100"></el-table-column>
      <el-table-column label="重要程度" align="center" prop="importance" width="90"></el-table-column>
      <el-table-column label="固定资产明细账凭单号" align="center" prop="detailedAccountVoucherNumber" width="150"
      ></el-table-column>
      <el-table-column label="使用人" align="center" prop="peopleUse" width="100"></el-table-column>
      <el-table-column label="保管人" align="center" prop="preserver" width="100"></el-table-column>
      <el-table-column label="领用日期" align="center" prop="claimingDate" width="150"></el-table-column>
      <el-table-column label="办公场所" align="center" prop="officeSpace" width="150"></el-table-column>
      <el-table-column label="存放区域" align="center" prop="storageArea" width="150"></el-table-column>
      <el-table-column label="详细位置" align="center" prop="detailedLocation" width="180"></el-table-column>
      <el-table-column label="来源" align="center" prop="source" width="150"></el-table-column>
      <el-table-column label="组织采购形式" align="center" prop="organizationalPurchasingForm" width="120"></el-table-column>
      <el-table-column label="原领用人" align="center" prop="originalOwner" width="120"></el-table-column>
      <el-table-column label="盘实" align="center" prop="discRepletion" width="100"></el-table-column>
      <el-table-column label="标签" align="center" prop="tag" width="100"></el-table-column>
      <el-table-column label="状态" align="center" prop="status" width="90"></el-table-column>
      <el-table-column label="报废年限" align="center" prop="retirementLife" width="150"></el-table-column>
      <el-table-column label="处置方案" align="center" prop="disposalScheme" width="150"></el-table-column>
      <el-table-column label="所属部门" align="center" prop="department" width="120"></el-table-column>
      <el-table-column label="处置优先级" align="center" prop="disposalPriority" width="90"></el-table-column>
      <el-table-column label="报废日期" align="center" prop="retirementDate" width="150"></el-table-column>
      <el-table-column label="备注" align="center"  prop="note" width="150"></el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="130">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="showProcess(scope.row)"
          >查看详情
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="handleQuery"
    />
  </div>
</template>

<script>
import { officeFinishedList } from '@/api/administeration/askForLeave.js'
import { BudgetCategory, budget_department } from '../../../../api/financial/budgetExecution'

export default {
  name: 'finished',
  dicts: ['fa_device_type', 'fa_asset_classify', 'fa_classify', 'fa_organizational_purchasing_form', 'fa_status', 'fa_disposal_scheme', 'fa_disposal_priority', 'fa_retirement_status'],
  data() {
    return {
      loading: true,
      leaveFinishedList: [],
      total: 0,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 查询条件显示条件
      showSearch:true,
      queryParams: {
        serialCode: null,
        budgetProjectCode: null,
        budgetProjectName: null,
        category: null,
        budgetSource: null,
        budgetTotalAmount: null,
        budgetBalance: null,
        executingDepartment: null,
        executionPeriod: null,
        executionDeadline: null
      },
      excutionList: [],
      deptOptions: [],
      sourcesList: [],
      departmentList: [],
      CategoryList: [],
      Code: 'CODE_ASSET'
    }
  },
  activated() {
    this.getList()
    // this.getDeptListAll()
  },
  created() {
    this.getList()
    this.category()
    this.inItPage()
    // this.getDeptListAll()
    // this.getSelectStatus()
  },
  methods: {
    // 部门查询
    inItPage() {
      budget_department().then(res => {
        for (let i = 0; i < res.data.length; i++) {
          this.departmentList.push(res.data[i].dictLabel)
        }
      })
    },
    // 预算大类
    category() {
      BudgetCategory().then(res => {
        this.CategoryList = res.data
      })
    },
    handleExport() {
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    handleQuery() {
      this.getList()
    },
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        category: null,
        classify: null,
        totalAmount: null,
        ProjectCode: null,
        ProjectName: null
      }
      this.handleQuery()
    },
    getList() {
      this.loading = true;
      officeFinishedList({ ...this.queryParams }, this.Code).then(
        response => {
          this.excutionList = response.rows
          this.total = response.total
        }
      ).finally(() => {
        this.loading = false;
      })
    },
    // 查看流程详情
    showProcess(row) {
      this.$router.push({
        path: '/workflow/process/assetsfinisheddetail/' + row.procInstId,
        query: {
          id: row.id,
          assetTagNumber: row.assetTagNumber,
          status: row.status
        }
      })
    },
  }
}

</script>

<style lang="less" scoped>

</style>
